﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace Anuntiomatic.Server
{
    public partial class SysUserRoleMenu : BaseClass
    {
        public static bool CheckExists(int userId, int menuId, string roleCode)
        {
            try
            {
                return (bool)ExecuteScalar("usp_SysUserRoleMenu_CheckExists", CommandType.StoredProcedure,
                        new SqlParameter("@UserID", userId),
                        new SqlParameter("@MenuID", menuId),
                        new SqlParameter("@RoleCode", roleCode));
            }
            catch
            {
                return false;
            }
        }

        public static void SetRight(int userId, int menuId, string roleCode, bool check)
        {
            try
            {
                ExecuteProc("usp_SysUserRoleMenu_SetRight",
                    new SqlParameter("@UserID", userId),
                    new SqlParameter("@MenuID", menuId),
                    new SqlParameter("@RoleCode", roleCode),
                    new SqlParameter("@Checked", check));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
    }
}
